<template>
  <div v-if="queryList.length>0">
    <a-col v-for="(item, index) in queryList" :key="index" :xl="item.queryType==='1'?4:6" :lg="item.queryType==='1'?5:7" :md="item.queryType==='1'?6:8" :sm="24">
      <a-form-item :label="item.tableName" v-if="item.queryType==='1'">
        <a-input v-if="item.tableType==='input' ||  item.tableType==='text'"  v-model="queryParam[item.queryKey]" :placeholder="'请输入'+item.tableName"  ></a-input>
        <a-input-number v-if="item.tableType==='input-number'"  v-model="queryParam[item.queryKey]" :placeholder="'请输入'+item.tableName" style="width: 100%"  ></a-input-number>
        <j-dict-select-tag v-else-if="item.tableType==='select' || item.tableType==='radio' || item.tableType==='checkbox'" v-model="queryParam[item.queryKey]" :placeholder="'请选择'+item.tableName" :dict-code="item.dataCode" />
        <j-date v-else-if="item.tableType==='date' || item.tableType==='date-time'" v-model="queryParam[item.queryKey]" date-format="YYYY-MM-DD" :placeholder="'请选择'+item.tableName"  style="width: 100%" />
      </a-form-item>
      <a-form-item :label="item.tableName" v-if="item.queryType==='2'">
        <span v-if="item.tableType==='input' || item.tableType==='input-number' || item.tableType==='text'" >
         <a-input  v-if="item.tableType==='input'  || item.tableType==='text'"  v-model="queryParam[item.queryKey+'_begin']" :placeholder="'请输入最小值'" style="width: 45%" ></a-input>
         <a-input-number  v-if="item.tableType==='input-number'"  v-model="queryParam[item.queryKey+'_begin']" :placeholder="'请输入最小值'" style="width: 45%" ></a-input-number>
         <span class="query-group-split-cust"></span>
         <a-input  v-if="item.tableType==='input' || item.tableType==='text'" v-model="queryParam[item.queryKey+'_end']" :placeholder="'请输入最大值'" style="width: 45%" ></a-input>
         <a-input-number  v-if="item.tableType==='input-number'" v-model="queryParam[item.queryKey+'_end']" :placeholder="'请输入最大值'"  style="width: 45%" ></a-input-number>
        </span>
        <span v-else-if="item.tableType==='date' || item.tableType==='date-time'" >
         <j-date v-model="queryParam[item.queryKey+'_begin']" class="query-group-cust" date-format="YYYY-MM-DD" :placeholder="'请选择开始时间'"/>
          <span class="query-group-split-cust"></span>
         <j-date v-model="queryParam[item.queryKey+'_end']" class="query-group-cust" date-format="YYYY-MM-DD" :placeholder="'请选择结束时间'" />
        </span>
      </a-form-item>
    </a-col>
  </div>

</template>


<script>

  import { getAction  } from '@/api/manage'

  export default {
    name: 'JItemQuery',
    components: {
    },
    props: {
      orgCode: {
        type: String,
        required: false,
        default: '',
      },
      dataType: {
        type: String,
        required: false,
        default: '',
      },
      notOrgCode: {
        type: String,
        required: false,
        default: '',
      },
      queryParam:{
        type:Object,
        required: false,
        default: {},
      }

    },
    /*监听图片值*/
    watch:{

    },
    data () {
      return {
        queryList:[],
        url:{
          getQuery: "/reportProcessNode/getQuery",
        },
      }
    },

    created() {
      this.getQuery();
    },
    mounted(){
    },
    methods: {
      getQuery(){
        getAction(this.url.getQuery,{dataType:this.dataType,orgCode:this.orgCode,notOrgCode:this.notOrgCode}).then(res=>{
          if(res.success){
            this.$set(this,'queryList',res.result)
          }else{
            this.$message.warning(res.message)
          }
        })
      },
    },
  }
</script>

<style scoped>

</style>
